package com.haixee.parkdemo.common.response;

import lombok.Getter;

/**
 * 自定义状态码
 *
 * @author GUIFENG GUO
 * 2020/3/22 7:58
 */
@Getter
public enum CommonResEnum implements ResultPort {

    // OK Success
    SUCCESS(0, "OK"),

    // 2000
    PERMISSION_DENIED(2000, "您没有权限访问"),
    TOKEN_EXPIRED(2000, "登录已过期，请重新登录"),
    TOKEN_ERROR(2000, "TOKEN异常"),
    // 不必重新登录
    PERMISSION_DENIED_NO_NEED_LOGIN(2100, "您没有权限访问"),
    WX_LOGIN_CODE_ERROR(21001, "登录异常"),

    // 4000 用户访问异常
    BAD_REQUEST(4000, "缺少参数或参数错误"),
    TOO_MANY_REQUESTS(4001, "您请求得太频繁，请稍后重试"),
    URL_BING_ERROR(4002, "url绑定路由问题"),
    NO_HANDLER_FOUND(4003, "没有找到对应的访问路径"),
    SIGN_ERROR(4004, "验签失败"),

    // 5000 服务异常
    UNKNOWN_ERROR(5000, "服务器繁忙"),
    ACCESS_ERROR(5001, "访问外部错误"),
    REDIS_LOCK_TIMEOUT(5002, "超时"),
    TRANSACTION_ERROR(5003, "事务出错"),
    NO_SUCH_MQ_TYPE(5004, "未知的事务类型"),
    ERROR_SETTING(5005, "服务配置错误"),
    ILLEGAL_CONTENT(5006, "可能存在违规的内容"),
    FILE_UP_ERROR(5007, "文件上传异常"),
    REQUEST_ERROR(5008, "请求异常"),
    ;

    private final Integer code;

    private final String msg;

    CommonResEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }
}
